package org.phmanago.gui;

import java.awt.*;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;

import java.awt.event.*;
import java.util.Iterator;

import org.phmanago.core.*;

public class SettingsPanel extends JPanel {
	
	public SettingsPanel() {
		initComponents();
	}
	
	public void initComponents() {
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        
        add(createOption("Szablon", JTextField.class));
        add(createOption("Plik wynikowy", JComboBox.class));
        add(createOption("Temat wyjsciowy", JComboBox.class));
        add(createOption("Typ wyniku", JComboBox.class));
        add(createOption("", JPanel.class));
        setVisible(true);
        setPreferredSize(new Dimension(200,350));
	}
	
	private JPanel createOption(String text, Class type) {
		JPanel p = new JPanel();
		p.setLayout(new FlowLayout());
		
		p.add(new Label(text));
		Component c = null;
		try {
			c = (Component)type.newInstance();
			c.setPreferredSize(new Dimension(50, 20));
		} catch (InstantiationException e) {
			System.err.println(e.getMessage());
			c = new JPanel();
		} catch (IllegalAccessException e) {
			System.err.println(e.getMessage());
			c = new JPanel();
		}

		p.add(c);
		
		return p;
		
	}

}
